package com.user.entity;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.achievement.entity.Subject;

@Entity
@Table(name="t_teacher")
public class Teacher {
	private Long id;
	private String num;
	private String name;
	private String sex;
	private Department department;
	private Set<Subject> subjs = new HashSet<Subject>();
	private String password;
	private boolean revoked;
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}
	public String getNum() {
		return num;
	}
	public String getName() {
		return name;
	}
	public String getSex() {
		return sex;
	}
	@ManyToOne(fetch=FetchType.EAGER)
	public Department getDepartment() {
		return department;
	}
	@ManyToMany(fetch=FetchType.EAGER)
	@JoinTable(name="t_teacher_subject",joinColumns= {@JoinColumn(name="teacher_id")},inverseJoinColumns= {@JoinColumn(name="subject_id")})
	public Set<Subject> getSubjs() {
		return subjs;
	}
	public String getPassword() {
		return password;
	}
	
	public boolean isRevoked() {
		return revoked;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public void setNum(String num) {
		this.num = num;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
	public void setDepartment(Department department) {
		this.department = department;
	}
	public void setSubjs(Set<Subject> subjs) {
		this.subjs = subjs;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public void setRevoked(boolean revoked) {
		this.revoked = revoked;
	}
	
}
